backcomponent.controller('SQLCtrl', function($scope, $http) {
    $scope.sql = 'SELECT * FROM SWEET_DEMO_USER';
    $scope.myColumn = undefined; 
    
    $scope.gridOptions = {
        data: 'myData',
        columnDefs: 'myColumn',
        enablePaging: false,
        showFooter: false,
        enableCellEdit: true,
        enableColumnResize: true,
        enableColumnReordering: true,
        maintainColumnRatios: false,
        selectWithCheckboxOnly: true,
        showSelectionCheckbox: false
    };
	
    $scope.getDataAsync = function () {
    	$http.get(encodeURL('/backcomponent/sqlmapper?sql='+$scope.sql)).success(function (resp) {
        	if(resp.datas.sqlresult != undefined && resp.datas.sqlresult.length > 0){      		       		
        		$scope.myData = resp.datas.sqlresult;
        	}
        });
    };
    //$scope.getDataAsync();    
});